/*
 * Copyright (C) OpenTX
 *
 * Based on code named
 *   th9x - http://code.google.com/p/th9x
 *   er9x - http://code.google.com/p/er9x
 *   gruvin9x - http://code.google.com/p/gruvin9x
 *
 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _MODULES_CONSTANTS_H_
#define _MODULES_CONSTANTS_H_

enum ModuleType {
  MODULE_TYPE_NONE = 0,
  MODULE_TYPE_PPM,
  MODULE_TYPE_XJT_PXX1,
  MODULE_TYPE_ISRM_PXX2,
  MODULE_TYPE_DSM2,
  MODULE_TYPE_CROSSFIRE,
  MODULE_TYPE_MULTIMODULE,
  MODULE_TYPE_R9M_PXX1,  // R9M
  MODULE_TYPE_R9M_PXX2,  // R9M ACCESS
  MODULE_TYPE_R9M_LITE_PXX1,  //R9MLite
  MODULE_TYPE_R9M_LITE_PXX2,  //R9MLP
  MODULE_TYPE_GHOST,     // Replaces MODULE_TYPE_R9M_LITE_PRO_PXX1 which doesn't exist
  MODULE_TYPE_R9M_LITE_PRO_PXX2,
  MODULE_TYPE_SBUS,
  MODULE_TYPE_XJT_LITE_PXX2,
  MODULE_TYPE_AFHDS3, //no more protocols possible because of 4 bits value
  MODULE_TYPE_COUNT,
  MODULE_TYPE_MAX = MODULE_TYPE_COUNT - 1
};

/* FrSky XJT / ISRM */

enum ModuleSubtypePXX1 {
  MODULE_SUBTYPE_PXX1_OFF = -1,
  MODULE_SUBTYPE_PXX1_ACCST_D16,
  MODULE_SUBTYPE_PXX1_ACCST_D8,
  MODULE_SUBTYPE_PXX1_ACCST_LR12,
  MODULE_SUBTYPE_PXX1_LAST = MODULE_SUBTYPE_PXX1_ACCST_LR12
};

enum ModuleSubtypeISRM_PXX2 {
  MODULE_SUBTYPE_ISRM_PXX2_ACCESS,
  MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16,
  MODULE_SUBTYPE_ISRM_PXX2_ACCST_LR12,
  MODULE_SUBTYPE_ISRM_PXX2_ACCST_D8,
  MODULE_SUBTYPE_ISRM_PXX2_LAST = MODULE_SUBTYPE_ISRM_PXX2_ACCST_D8
};

enum R9MLiteLBTPowerValues {
  R9M_LITE_LBT_POWER_25_8CH = 0,
  R9M_LITE_LBT_POWER_25_16CH,
  R9M_LITE_LBT_POWER_100_16CH_NOTELEM,
  R9M_LITE_LBT_POWER_MAX = R9M_LITE_LBT_POWER_100_16CH_NOTELEM
};

enum R9MFCCPowerValues {
  R9M_FCC_POWER_10 = 0,
  R9M_FCC_POWER_100,
  R9M_FCC_POWER_500,
  R9M_FCC_POWER_1000,
  R9M_FCC_POWER_MAX = R9M_FCC_POWER_1000
};

enum R9MLBTPowerValues {
  R9M_LBT_POWER_25_8CH = 0,
  R9M_LBT_POWER_25_16CH,
  R9M_LBT_POWER_200_16CH_NOTELEM,
  R9M_LBT_POWER_500_16CH_NOTELEM,
  R9M_LBT_POWER_MAX = R9M_LBT_POWER_500_16CH_NOTELEM
};

enum AntennaTypes {
  XJT_INTERNAL_ANTENNA,
  XJT_EXTERNAL_ANTENNA
};

/* FrSky R9M / R9M-Lite & co */

enum ModuleSubtypeR9M {
  MODULE_SUBTYPE_R9M_FCC,
  MODULE_SUBTYPE_R9M_EU,
  MODULE_SUBTYPE_R9M_EUPLUS,
  MODULE_SUBTYPE_R9M_AUPLUS,
  MODULE_SUBTYPE_R9M_LAST=MODULE_SUBTYPE_R9M_AUPLUS
};

/* Multi module */

enum ModuleSubtypeMulti {
  MODULE_SUBTYPE_MULTI_FIRST = 0,
  MODULE_SUBTYPE_MULTI_FLYSKY = MODULE_SUBTYPE_MULTI_FIRST,
  MODULE_SUBTYPE_MULTI_HUBSAN, //1
  MODULE_SUBTYPE_MULTI_FRSKY,  //2
  MODULE_SUBTYPE_MULTI_HISKY,  //3
  MODULE_SUBTYPE_MULTI_V2X2,   //4
  MODULE_SUBTYPE_MULTI_DSM2,   //5
  MODULE_SUBTYPE_MULTI_DEVO,
  MODULE_SUBTYPE_MULTI_YD717,
  MODULE_SUBTYPE_MULTI_KN,
  MODULE_SUBTYPE_MULTI_SYMAX,
  MODULE_SUBTYPE_MULTI_SLT,    //10
  MODULE_SUBTYPE_MULTI_CX10,
  MODULE_SUBTYPE_MULTI_CG023,
  MODULE_SUBTYPE_MULTI_BAYANG,
  MODULE_SUBTYPE_MULTI_ESky,
  MODULE_SUBTYPE_MULTI_MT99XX, //15
  MODULE_SUBTYPE_MULTI_MJXQ,
  MODULE_SUBTYPE_MULTI_SHENQI,
  MODULE_SUBTYPE_MULTI_FY326,
  MODULE_SUBTYPE_MULTI_FUTABA,
  MODULE_SUBTYPE_MULTI_J6PRO, //20
  MODULE_SUBTYPE_MULTI_FQ777,
  MODULE_SUBTYPE_MULTI_ASSAN,
  MODULE_SUBTYPE_MULTI_HONTAI,
  MODULE_SUBTYPE_MULTI_OLRS,
  MODULE_SUBTYPE_MULTI_FS_AFHDS2A,  //25
  MODULE_SUBTYPE_MULTI_Q2X2,
  MODULE_SUBTYPE_MULTI_WK_2X01,
  MODULE_SUBTYPE_MULTI_Q303,
  MODULE_SUBTYPE_MULTI_GW008,
  MODULE_SUBTYPE_MULTI_DM002,  //30
  MODULE_SUBTYPE_MULTI_CABELL,
  MODULE_SUBTYPE_MULTI_ESKY150,
  MODULE_SUBTYPE_MULTI_H83D,
  MODULE_SUBTYPE_MULTI_CORONA,
  MODULE_SUBTYPE_MULTI_CFLIE,  //35
  MODULE_SUBTYPE_MULTI_HITEC,
  MODULE_SUBTYPE_MULTI_WFLY,
  MODULE_SUBTYPE_MULTI_BUGS,
  MODULE_SUBTYPE_MULTI_BUGS_MINI,
  MODULE_SUBTYPE_MULTI_TRAXXAS,  //40
  MODULE_SUBTYPE_MULTI_NCC1701,
  MODULE_SUBTYPE_MULTI_E01X,
  MODULE_SUBTYPE_MULTI_V911S,
  MODULE_SUBTYPE_MULTI_GD00X,
  MODULE_SUBTYPE_MULTI_V761,  //45
  MODULE_SUBTYPE_MULTI_KF606,
  MODULE_SUBTYPE_MULTI_REDPINE,
  MODULE_SUBTYPE_MULTI_POTENSIC,
  MODULE_SUBTYPE_MULTI_ZSX,
  MODULE_SUBTYPE_MULTI_HEIGHT,  //50
  MODULE_SUBTYPE_MULTI_SCANNER,
  MODULE_SUBTYPE_MULTI_FRSKYX_RX,
  MODULE_SUBTYPE_MULTI_AFHDS2A_RX,
  MODULE_SUBTYPE_MULTI_HOTT,
  MODULE_SUBTYPE_MULTI_FX816,   //55
  MODULE_SUBTYPE_MULTI_BAYANG_RX,
  MODULE_SUBTYPE_MULTI_PELIKAN,
  MODULE_SUBTYPE_MULTI_TIGER,
  MODULE_SUBTYPE_MULTI_XK,
  MODULE_SUBTYPE_MULTI_XN297DUMP,  //60
  MODULE_SUBTYPE_MULTI_FRSKYX2,
  MODULE_SUBTYPE_MULTI_FRSKY_R9,
  MODULE_SUBTYPE_MULTI_PROPEL,
  MODULE_SUBTYPE_MULTI_FRSKYL,
  MODULE_SUBTYPE_MULTI_SKYARTEC,  //65
  MODULE_SUBTYPE_MULTI_ESKY150V2,
  MODULE_SUBTYPE_MULTI_DSM_RX,
  MODULE_SUBTYPE_MULTI_JJRC345,
  MODULE_SUBTYPE_MULTI_Q90C,
  MODULE_SUBTYPE_MULTI_KYOSHO,  //70
  MODULE_SUBTYPE_MULTI_RLINK,
  MODULE_SUBTYPE_MULTI_ELRS,
  MODULE_SUBTYPE_MULTI_REALACC,
  MODULE_SUBTYPE_MULTI_OMP,
  MODULE_SUBTYPE_MULTI_MLINK,   //75
  MODULE_SUBTYPE_MULTI_WFLY2,
  MODULE_SUBTYPE_MULTI_E016HV2,
  MODULE_SUBTYPE_MULTI_E010R5,
  MODULE_SUBTYPE_MULTI_LOLI,
  MODULE_SUBTYPE_MULTI_E129,    //80
  MODULE_SUBTYPE_MULTI_JOYSWAY,
  MODULE_SUBTYPE_MULTI_E016H,
  MODULE_SUBTYPE_MULTI_CONFIG,
  MODULE_SUBTYPE_MULTI_IKEAANSLUTA,
  MODULE_SUBTYPE_MULTI_WILLIFM,  //85
  MODULE_SUBTYPE_MULTI_LOSI,
  MODULE_SUBTYPE_MULTI_MOULDKG,
  MODULE_SUBTYPE_MULTI_XERALL,
  MODULE_SUBTYPE_MULTI_MT99XX2,
  MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_MT99XX2
};

enum MMDSM2Subtypes {
  MM_RF_DSM2_SUBTYPE_DSM2_22,
  MM_RF_DSM2_SUBTYPE_DSM2_11,
  MM_RF_DSM2_SUBTYPE_DSMX_22,
  MM_RF_DSM2_SUBTYPE_DSMX_11,
  MM_RF_DSM2_SUBTYPE_AUTO
};

enum MMRFrskySubtypes {
  MM_RF_FRSKY_SUBTYPE_D16,
  MM_RF_FRSKY_SUBTYPE_D8,
  MM_RF_FRSKY_SUBTYPE_D16_8CH,
  MM_RF_FRSKY_SUBTYPE_V8,
  MM_RF_FRSKY_SUBTYPE_D16_LBT,
  MM_RF_FRSKY_SUBTYPE_D16_LBT_8CH,
  MM_RF_FRSKY_SUBTYPE_D8_CLONED,
  MM_RF_FRSKY_SUBTYPE_D16_CLONED
};

enum MMRFrskyX2Subtypes {
  MM_RF_FRSKYX2_SUBTYPE_D16,
  MM_RF_FRSKYX2_SUBTYPE_D8,
  MM_RF_FRSKYX2_SUBTYPE_D16_LBT,
  MM_RF_FRSKYX2_SUBTYPE_D16_LBT_8CH,
  MM_RF_FRSKYX2_SUBTYPE_D16_CLONED
};

enum ModuleSubtypeDSM2 {
  DSM2_PROTO_LP45,
  DSM2_PROTO_DSM2,
  DSM2_PROTO_DSMX,
};

enum FailsafeModes {
  FAILSAFE_NOT_SET,
  FAILSAFE_HOLD,
  FAILSAFE_CUSTOM,
  FAILSAFE_NOPULSES,
  FAILSAFE_RECEIVER,
  FAILSAFE_LAST = FAILSAFE_RECEIVER
};

enum AntennaModes {
  ANTENNA_MODE_INTERNAL = -2,
  ANTENNA_MODE_ASK = -1,
  ANTENNA_MODE_PER_MODEL = 0,
  ANTENNA_MODE_EXTERNAL = 1,
  ANTENNA_MODE_FIRST = ANTENNA_MODE_INTERNAL,
  ANTENNA_MODE_LAST = ANTENNA_MODE_EXTERNAL
};

enum AfhdsModes {
  AFHDS_SUBTYPE_FIRST,
  AFHDS_SUBTYPE_PWM_IBUS = AFHDS_SUBTYPE_FIRST,
  AFHDS_SUBTYPE_PWM_SBUS,
  AFHDS_SUBTYPE_PPM_IBUS,
  AFHDS_SUBTYPE_PPM_SBUS,
  AFHDS_SUBTYPE_LAST = AFHDS_SUBTYPE_PPM_SBUS
};

#endif // _MODULES_CONSTANTS_H_
